from fdfs_client.client import Fdfs_client

if __name__ == '__main__':
    client = Fdfs_client('client.conf')
    #sudo docker run -dti --name storage --network=host -e TRACKER_SERVER=192.168.43.67:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage
    # 上传
    data = client.upload_by_file('/home/python/Desktop/1.jpg')
    print(data)
    # '''
    # {
    #     'Remote file_id': 'group1/M00/00/02/wKgvgV2mcQyAf2jIAAAhg8MeEWU331.jpg',
    #     'Storage IP': '192.168.47.129',
    #     'Local file name': '/home/python/Desktop/1.jpg',
    #     'Group name': 'group1',
    #     'Status': 'Upload successed.',
    #     'Uploaded size': '8.00KB'
    # }
    # '''

    # 修改====>内部实现有错误
    # data = client.modify_by_file('/home/python/Desktop/2.jpg', 'group1/M00/00/02/wKgvgV2mcQyAf2jIAAAhg8MeEWU331.jpg')
    # print(data)

    # # 删除
    # data=client.delete_file('group1/M00/00/02/wKgvgV2mcQyAf2jIAAAhg8MeEWU331.jpg')
    # print(data)
    # '''
    # ('Delete file successed.', 'group1/M00/00/02/wKgvgV2mcQyAf2jIAAAhg8MeEWU331.jpg', '192.168.47.129')
    # '''
